package com.apes.fico.finance.model.gl;

import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.fico.masterdata.gl.model.AccountingOperatingChartAuxiliary;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @program: apestech
 * @description: 每期发生额(辅助核算内容明细)
 * @author: Chengxm
 * @create: 2019-01-15 13:49
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ChartAuxItem.CONST_TABLE_NAME)
public class ChartAuxItem implements ApesBean {
    public  final static  String CONST_TABLE_NAME = "gl_chart_aux_item";
    @Id
    @Column(name = "id", nullable = false, length = 120)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "年初余额表", padding = 8)
    @Comment("编号")
    private String id;

    @NotNull
    @ManyToOne()
    @JoinColumn(name = "chart_aux_id", referencedColumnName = "id")
    @Comment("辅助核算")
    private ChartAux chartAux;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "acc_aux_id", referencedColumnName = "id", nullable = false)
    @Comment("辅助类型标识")
    private AccountingOperatingChartAuxiliary accountingOperatingChartAuxiliary;

    @Column(name = "code", nullable = false, length = 64)
    @Comment("核算内容代码")
    private String code;

    @Column(name = "name", nullable = false, length = 200)
    @Comment("核算内容名称")
    private String name;
}
